/**
 *  Copyright 2011 Marco Berri - marcoberri@gmail.com
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and limitations under the License.
 **/
package com.mbfasttrack.model;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

/**
 * @author Marco Berri marcoberri@gmail.com http://tecnicume.blogspot.com
 */
@Document
public class Media implements Base {

    @Id
    @Indexed
    private String id;
    private String name;
    private String description;
    private String type;
    private Object fileId;
    @DBRef
    private User user;
    private List<MetaData> metadata = new ArrayList<MetaData>();     
    @Transient
    private String objtype;
    //@Transient
    private String objid;
    @Transient
    private CommonsMultipartFile multipartfile;
    @Transient
    private File file;
    

    /**
     * 
     * @return
     */
    public String toString() {
        return "[ id: " + this.id
                + " name:" + this.name
                + " description:" + this.description
                + " type:" + this.type
                + " fileId:" + this.fileId
                + " user:" + this.user
               // + " object:" + this.object
                + " objtype:" + this.objtype
                + " objid:" + this.objid
                + " ]";
    }

    /**
     * 
     */
    public Media() {
    }

    /**
     * @return the id
     */
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }


    public String getName() {
        return name;
    }

    /**
     * @param name 
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the file
     */
    public File getFile() {
        return file;
    }

    /**
     * @param file the file to set
     */
    public void setFile(File file) {
        this.file = file;
    }

    /**
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

    /**
     * 
     * @param fileId
     */
    public void setFileId(Object fileId) {
        this.fileId = fileId;
    }

    /**
     * @return the fileId
     */
    public Object getFileId() {
        return fileId;
    }




    /**
     * @return the objtype
     */
    public String getObjtype() {
        return objtype;
    }

    /**
     * @param objtype the objtype to set
     */
    public void setObjtype(String objtype) {
        this.objtype = objtype;
    }

    /**
     * @return the objid
     */
    public String getObjid() {
        return objid;
    }

    /**
     * @param objid the objid to set
     */
    public void setObjid(String objid) {
        this.objid = objid;
    }

    /**
     * @return the metadata
     */
    public List<MetaData> getMetadata() {
        return metadata;
    }

    /**
     * @param metadata the metadata to set
     */
    public void setMetadata(List<MetaData> metadata) {
        this.metadata = metadata;
    }

    /**
     * @return the multipartfile
     */
    public CommonsMultipartFile getMultipartfile() {
        return multipartfile;
    }

    /**
     * @param multipartfile the multipartfile to set
     */
    public void setMultipartfile(CommonsMultipartFile multipartfile) {
        this.multipartfile = multipartfile;
    }
}
